The number of applications under the control of managed runtime environments (MTREs), such as the Java Virtual Machine (JVM) and the Common Language Runtime (CLR), is increasing. These applications may need access to system components outside of the managed runtime environment. Such components may include legacy applications or components that provide access to platform-specific services. In the CLR, this kind of native code access may be performed by an invocation method that may have an overhead of between 10 and 30×86 instructions per call, for example. In addition to this fixed cost, if the parameters or the return value of the called function need to be marshalled, the marshalling may create additional overhead depending on the type and size of the data, for example.
As the developer community migrates towards MTREs, unmanaged software components will need to be integrated into these new MTRE-based systems. However, low-level platform components and legacy applications will not be managed by these MTREs for quite some time. Several approaches for integrating these low-level components and legacy applications fail to provide an efficient and easy-to-use mechanism for allowing managed and unmanaged code to interact.